package com.a.basis;

import java.util.Scanner;

public class TestGuess {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int cCount=0;//电脑的计数器
        int pCount=0;//人的计数器
        for (int i=1;i<=3;){

            int computer=((int)Math.random()*10)%3+1;
            System.out.println("请输入猜拳的编号（1.剪刀，2.石头,3.布）：");
            int player=scanner.nextInt();

            if (computer==player) {
                System.out.println("平局  不错哦！，再接再厉！");
                continue;       //平局不算入对局数
            } else if (player==1&& computer==3) {
                System.out.println("胜利");
                pCount++;
            }else{
                System.out.println("失败");
                cCount++;
            }

            if (cCount==2||pCount==2) {
                break;
            }

            i++;
        }
    }
}
